import java.io.*;
import java.util.*;

public class OStPartial75Solution{
    
    Scanner in;
    PrintWriter out;
    
    boolean checkRect(int i1, int j1, int i2, int j2, int[][] paintedRowSums, int[][] paintedColSums){
        
        int nRows = i2-i1+1;
        int nCols = j2-j1+1;
        return paintedRowSums[i1][j2]-paintedRowSums[i1][j1]==nCols-1 
            && paintedRowSums[i2][j2]-paintedRowSums[i2][j1]==nCols-1
            && paintedColSums[i2][j1]-paintedColSums[i1][j1]==nRows-1
            && paintedColSums[i2][j2]-paintedColSums[i1][j2]==nRows-1;
    }
    
    void solve() {
        int nRows = in.nextInt();
        int nCols = in.nextInt();
        in.nextLine();
        boolean wasPainted[][] = new boolean[nRows][nCols];
        int paintedRowSums[][] = new int[nRows][nCols];
        int paintedColSums[][] = new int[nRows][nCols];
        for (int i = 0; i < wasPainted.length; i++){
            String line = in.nextLine();
            for (int j = 0; j < wasPainted[0].length; j++){
                wasPainted[i][j] = line.charAt(j)=='*';
                if (wasPainted[i][j]){
                    paintedRowSums[i][j] = j==0 ? 1 : paintedRowSums[i][j-1]+1;
                    paintedColSums[i][j] = i==0 ? 1 : paintedColSums[i-1][j]+1;
                }else{
                    paintedRowSums[i][j] = j==0 ? 0 : paintedRowSums[i][j-1];
                    paintedColSums[i][j] = i==0 ? 0 : paintedColSums[i-1][j];
                }
            }
        }
        int answer = 0;
        for (int i1 = 0; i1 < wasPainted.length; i1++){
            for (int j1 = 0; j1 < wasPainted[0].length; j1++){
                if (wasPainted[i1][j1]){
                    for (int i2 = i1+2; i2 < wasPainted.length; i2++){
                        for (int j2 = j1+2; j2 < wasPainted[0].length; j2++){
                            if (wasPainted[i2][j2] && checkRect(i1, j1, i2, j2, paintedRowSums, paintedColSums)){
                                answer++;
                            }
                        }
                    }
                }
            }
        }
        out.println(answer);
	}
    
    void run() {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		try {
			solve();
		} finally {
			out.close();
		}
	}
    
    
    public static void main(String args[]){
        new OStPartial75Solution().run();
    }
    


}
